import { observable,computed, action, asMap, toJS } from 'mobx';
import * as API from '../../api/fnaSpecial'
import { ListPage,ListViewPage } from 'weaver-mobile-page';
import { RouteLayout } from 'weaver-mobile-page';

export default class PopupListStore{
    @observable list = new ListPage.Store();
    @observable loding = false;

    template = {
        default: {
            theme: 'col2_row2',
            dataKeys: ['user', 'decription', 'amount', 'time']
        }
      };
    
    template2 = {
            default: '<div style="padding: 0 12px"><div style="color: #333; font-size: 16px">#{user}</div>' +
            '<div style="color: #f00; font-size: 14px">#{amount}</div>' +
            '<div style="color: #333; font-size: 14px">#{time}</div>' +
            '<div style="color: #333; font-size: 14px">#{decription}</div></div>',
    };

    
    //获取修改金额日志list
    @action
    getPopupList = (params) => {
        this.loding = true;
        params = {dataType:0, ...params};
        API.getPopupList(params).then( result => {
            const { datas } = result;
            let data = datas.map((item) => (
                {
                    user: `${item.user}`,
                    id: `${item.id}`,
                    amount: `调整后的金额:${item.amount}元`,
                    time: `${item.time}`,
                    decription: `${item.decription}`
                }
              ));
            this.list.setState({ data });//一定要写data
            this.loding = false;
        })
    }
}